#!/bin/bash

sudo apt update
sudo apt dist-upgrade -y

# 安装并配置git
sudo apt install git
git config --global pull.rebase false
git config --global user.email 717606641@qq.com
git config --global user.name zhang

# 安装python相关
sudo apt install python3-pip
sudo apt install python3-venv

# 安装gtk4相关
sudo apt install build-essential pkg-config gdb meson ninja-build cmake
sudo apt install libgtk-4-1 libgtk-4-dev
sudo apt install libjson-glib-dev

# 安装编译器相关
sudo apt install flex bison

# 安装OpenGL相关
sudo apt install libgl1-mesa-dev freeglut3-dev libglew-dev mesa-utils libglfw3-dev
# 检查OpenGL版本
glxinfo | grep "OpenGL version"

# 安装nodejs相关
bash ./install-nvm.sh
nvm install 20
npm -g i pnpm yarn serve
nvm install 16
npm -g i pnpm yarn serve

# 安装flatpak相关
sudo apt install flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo
flatpak install gnome-nightly org.gtk.Demo4
flatpak install gnome-nightly org.gtk.WidgetFactory4
flatpak install gnome-nightly org.gtk.IconBrowser4